package com.gis.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @author LnnuUser
 * @create 2021-08-27-下午6:36
 */
object Spark07_RDD_Operator_Transform_Test {

  def main(args: Array[String]): Unit = {

    val sparkConf: SparkConf = new SparkConf().setMaster("local[*]").setAppName("Operator")
    val sc: SparkContext = new SparkContext(sparkConf)


    // TODO 算子 --filter

    var rdd = sc.textFile("datas/apache.log")

    rdd.filter(
      line => {
        val datas: Array[String] = line.split(" ")
        val times: String = datas(3)
        times.startsWith("17/05/2015")
      }
    ).collect().foreach(println)

    sc.stop()

  }

}
